package game.gui;

import game.controller.DisplayController;
import game.controller.GameController;
import game.controller.FlashAnimation;
import game.util.GameMsg;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

import lobby.controller.Nation;
import shared.controller.LobbyConstants;

/**
 * ChatChooser.java  Date Created: Oct 24, 2012
 *
 * Purpose: To display the different chat windows to choose from.
 *
 * Description: This panel shall display the selectable chat windows.
 * The currently selected chat window will be highlighted with a box
 * around it.  A chat window that receives a message will flash twice.
 * A chat window that has an unread message will remain a specific color.
 * Only player-controlled nations can be selected.
 *
 * The available chat windows may vary based on Game mode and scenario.
 *
 * @author Chrisb
 */
public class ChatChooser extends JPanel implements MouseListener, ActionListener {

    public ChatChooser(GameController controller, DisplayController display) {
        super();
        this.controller = controller;
        this.display = display;
        nation = this.controller.getUserNation();

        createComponents();
        layoutComponents();
        createPopupMenus();

        setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
        setBackground(Color.GRAY);
        setPreferredSize(new Dimension(225,175));
        setMaximumSize(new Dimension(225,175));
        setMinimumSize(new Dimension(225,175));
        setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 4), BorderFactory.createEmptyBorder(10,10,10,10)));
    }

    private void createComponents() {

        //global
        global = new JLabel(GameMsg.getString("cc.global.label"));
        global.addMouseListener(this);
        global.setCursor(new Cursor(Cursor.HAND_CURSOR));
        global.setPreferredSize(new Dimension(60,28));
        global.setBorder(BorderFactory.createLineBorder(Color.BLACK, 2));
        global.setHorizontalAlignment(SwingConstants.CENTER);
        globalAnimation = new FlashAnimation(global);


        if (controller.getGameMode() == LobbyConstants.EMPIRE) {

            //Initalize
            france = new JLabel(GameMsg.getString("cc.france.label"));
            greatBritain = new JLabel(GameMsg.getString("cc.greatBritain.label"));
            prussia = new JLabel(GameMsg.getString("cc.prussia.label"));
            russia = new JLabel(GameMsg.getString("cc.russia.label"));
            ottoman = new JLabel(GameMsg.getString("cc.ottoman.label"));
            austria = new JLabel(GameMsg.getString("cc.austria.label"));
            spain = new JLabel(GameMsg.getString("cc.spain.label"));

            //add actions
            france.addMouseListener(this);
            greatBritain.addMouseListener(this);
            prussia.addMouseListener(this);
            russia.addMouseListener(this);
            ottoman.addMouseListener(this);
            austria.addMouseListener(this);
            spain.addMouseListener(this);

            france.setBorder(BorderFactory.createEmptyBorder(2,2,2,2));
            greatBritain.setBorder(BorderFactory.createEmptyBorder(2,2,2,2));
            prussia.setBorder(BorderFactory.createEmptyBorder(2,2,2,2));
            russia.setBorder(BorderFactory.createEmptyBorder(2,2,2,2));
            ottoman.setBorder(BorderFactory.createEmptyBorder(2,2,2,2));
            austria.setBorder(BorderFactory.createEmptyBorder(2,2,2,2));
            spain.setBorder(BorderFactory.createEmptyBorder(2,2,2,2));

            france.setHorizontalAlignment(SwingConstants.CENTER);
            greatBritain.setHorizontalAlignment(SwingConstants.CENTER);
            prussia.setHorizontalAlignment(SwingConstants.CENTER);
            russia.setHorizontalAlignment(SwingConstants.CENTER);
            ottoman.setHorizontalAlignment(SwingConstants.CENTER);
            austria.setHorizontalAlignment(SwingConstants.CENTER);
            spain.setHorizontalAlignment(SwingConstants.CENTER);

            franceAnimation = new FlashAnimation(france);
            greatBritainAnimation = new FlashAnimation(greatBritain);
            prussiaAnimation = new FlashAnimation(prussia);
            russiaAnimation = new FlashAnimation(russia);
            ottomanAnimation = new FlashAnimation(ottoman);
            austriaAnimation = new FlashAnimation(austria);
            spainAnimation = new FlashAnimation(spain);



        } else if (controller.getGameMode() == LobbyConstants.TEAM) {
            team = new JLabel(GameMsg.getString("cc.team.label"));
            team.addMouseListener(this);
            team.setBorder(BorderFactory.createEmptyBorder(2,2,2,2));
            team.setHorizontalAlignment(SwingConstants.CENTER);
            teamAnimation = new FlashAnimation(team);
        }
    }

    private void layoutComponents() {
        if (controller.getGameMode() == LobbyConstants.EMPIRE) {

            JPanel globalRow = new JPanel();
            globalRow.setBackground(Color.GRAY);
            globalRow.setLayout(new BoxLayout(globalRow, BoxLayout.LINE_AXIS));
            globalRow.add(Box.createHorizontalGlue());
            globalRow.add(global);
            globalRow.add(Box.createHorizontalGlue());

            add(globalRow);

            JPanel row1 = new JPanel();
            row1.setBackground(Color.GRAY);
            row1.setLayout(new BoxLayout(row1, BoxLayout.LINE_AXIS));
            JPanel row2 = new JPanel();
            row2.setBackground(Color.GRAY);
            row2.setLayout(new BoxLayout(row2, BoxLayout.LINE_AXIS));
            JPanel row3 = new JPanel();
            row3.setBackground(Color.GRAY);
            row3.setLayout(new BoxLayout(row3, BoxLayout.LINE_AXIS));
            Dimension rowSpacing = new Dimension(20,0);
            Dimension colSpacing = new Dimension(0,20);

            switch(nation) {
                case Nation.FRANCE:
                    row1.add(greatBritain);
                    row1.add(Box.createRigidArea(rowSpacing));
                    row1.add(ottoman);
                    row2.add(prussia);
                    row2.add(Box.createRigidArea(rowSpacing));
                    row2.add(austria);
                    row3.add(russia);
                    row3.add(Box.createRigidArea(rowSpacing));
                    row3.add(spain);
                    break;
                case Nation.GREAT_BRITAIN:
                    row1.add(france);
                    row1.add(Box.createRigidArea(rowSpacing));
                    row1.add(ottoman);
                    row2.add(prussia);
                    row2.add(Box.createRigidArea(rowSpacing));
                    row2.add(austria);
                    row3.add(russia);
                    row3.add(Box.createRigidArea(rowSpacing));
                    row3.add(spain);
                    break;
                case Nation.PRUSSIA:
                    row1.add(france);
                    row1.add(Box.createRigidArea(rowSpacing));
                    row1.add(ottoman);
                    row2.add(greatBritain);
                    row2.add(Box.createRigidArea(rowSpacing));
                    row2.add(austria);
                    row3.add(russia);
                    row3.add(Box.createRigidArea(rowSpacing));
                    row3.add(spain);
                    break;
                case Nation.RUSSIA:
                    row1.add(france);
                    row1.add(Box.createRigidArea(rowSpacing));
                    row1.add(ottoman);
                    row2.add(greatBritain);
                    row2.add(Box.createRigidArea(rowSpacing));
                    row2.add(austria);
                    row3.add(prussia);
                    row3.add(Box.createRigidArea(rowSpacing));
                    row3.add(spain);
                    break;
                case Nation.OTTOMANS:
                    row1.add(france);
                    row1.add(Box.createRigidArea(rowSpacing));
                    row1.add(russia);
                    row2.add(greatBritain);
                    row2.add(Box.createRigidArea(rowSpacing));
                    row2.add(austria);
                    row3.add(prussia);
                    row3.add(Box.createRigidArea(rowSpacing));
                    row3.add(spain);
                    break;
                case Nation.AUSTRIA_HUNGRY:
                    row1.add(france);
                    row1.add(Box.createRigidArea(rowSpacing));
                    row1.add(russia);
                    row2.add(greatBritain);
                    row2.add(Box.createRigidArea(rowSpacing));
                    row2.add(ottoman);
                    row3.add(prussia);
                    row3.add(Box.createRigidArea(rowSpacing));
                    row3.add(spain);
                    break;
                case Nation.SPAIN:
                    row1.add(france);
                    row1.add(Box.createRigidArea(rowSpacing));
                    row1.add(russia);
                    row2.add(greatBritain);
                    row2.add(Box.createRigidArea(rowSpacing));
                    row2.add(ottoman);
                    row3.add(prussia);
                    row3.add(Box.createRigidArea(rowSpacing));
                    row3.add(austria);
                    break;
            }

            add(Box.createRigidArea(colSpacing));
            add(row1);
            add(Box.createRigidArea(colSpacing));
            add(row2);
            add(Box.createRigidArea(colSpacing));
            add(row3);

        } else if (controller.getGameMode() == LobbyConstants.TEAM) {
            //todo layout team..
        }
    }

    public void createPopupMenus() {
        nationPopup = new JPopupMenu();
        JMenuItem item = new JMenuItem(GameMsg.getString("menu.declare"));
        item.addActionListener(this);
        item.setActionCommand(GameMsg.getString("declare.action"));
        nationPopup.add(item);

        item = new JMenuItem(GameMsg.getString("menu.armistice"));
        item.addActionListener(this);
        item.setActionCommand(GameMsg.getString("armistice.action"));
        nationPopup.add(item);

        item = new JMenuItem(GameMsg.getString("menu.formAlly"));
        item.addActionListener(this);
        item.setActionCommand(GameMsg.getString("formAlly.action"));
        nationPopup.add(item);

        item = new JMenuItem(GameMsg.getString("menu.breakAlly"));
        item.addActionListener(this);
        item.setActionCommand(GameMsg.getString("breakAlly.action"));
        nationPopup.add(item);

        item = new JMenuItem(GameMsg.getString("menu.grantRights"));
        item.addActionListener(this);
        item.setActionCommand(GameMsg.getString("grantRights.action"));
        nationPopup.add(item);

        item = new JMenuItem(GameMsg.getString("menu.rescindRights"));
        item.addActionListener(this);
        item.setActionCommand(GameMsg.getString("rescindRights.action"));
        nationPopup.add(item);

        item = new JMenuItem(GameMsg.getString("menu.nationSummary"));
        item.addActionListener(this);
        item.setActionCommand(GameMsg.getString("nationSummary.action"));
        nationPopup.add(item);

        item = new JMenuItem(GameMsg.getString("menu.commanderInfo"));
        item.addActionListener(this);
        item.setActionCommand(GameMsg.getString("commanderInfo.action"));
        nationPopup.add(item);
    }

    public void setupCursors() {
        if (controller.isPlayerNation(Nation.FRANCE))
            france.setCursor(new Cursor(Cursor.HAND_CURSOR));
        if (controller.isPlayerNation(Nation.GREAT_BRITAIN))
            greatBritain.setCursor(new Cursor(Cursor.HAND_CURSOR));
        if (controller.isPlayerNation(Nation.PRUSSIA))
            prussia.setCursor(new Cursor(Cursor.HAND_CURSOR));
        if (controller.isPlayerNation(Nation.RUSSIA))
            russia.setCursor(new Cursor(Cursor.HAND_CURSOR));
        if (controller.isPlayerNation(Nation.OTTOMANS))
            ottoman.setCursor(new Cursor(Cursor.HAND_CURSOR));
        if (controller.isPlayerNation(Nation.AUSTRIA_HUNGRY))
            austria.setCursor(new Cursor(Cursor.HAND_CURSOR));
        if (controller.isPlayerNation(Nation.SPAIN))
            spain.setCursor(new Cursor(Cursor.HAND_CURSOR));
    }

    /*
     * A new nation chat window has been opened.
     * Remove border from old nation and add one
     * to the new nations.  set nation to new nation.
     */
    public void setChatNation(int oldNation, int newNation) {        
        switch (oldNation) {
            case Nation.GLOBAL: globalAnimation = new FlashAnimation(global); global.setBorder(BorderFactory.createEmptyBorder(2,2,2,2)); break;
            case Nation.FRANCE: franceAnimation = new FlashAnimation(france); france.setBorder(BorderFactory.createEmptyBorder(2,2,2,2)); break;
            case Nation.GREAT_BRITAIN: greatBritainAnimation = new FlashAnimation(greatBritain); greatBritain.setBorder(BorderFactory.createEmptyBorder(2,2,2,2)); break;
            case Nation.PRUSSIA: prussiaAnimation = new FlashAnimation(prussia); prussia.setBorder(BorderFactory.createEmptyBorder(2,2,2,2)); break;
            case Nation.RUSSIA: russiaAnimation = new FlashAnimation(russia); russia.setBorder(BorderFactory.createEmptyBorder(2,2,2,2)); break;
            case Nation.OTTOMANS: ottomanAnimation = new FlashAnimation(ottoman); ottoman.setBorder(BorderFactory.createEmptyBorder(2,2,2,2)); break;
            case Nation.AUSTRIA_HUNGRY: austriaAnimation = new FlashAnimation(austria); austria.setBorder(BorderFactory.createEmptyBorder(2,2,2,2)); break;
            case Nation.SPAIN: spainAnimation = new FlashAnimation(spain); spain.setBorder(BorderFactory.createEmptyBorder(2,2,2,2)); break;
            case Nation.TEAM: teamAnimation = new FlashAnimation(team); team.setBorder(BorderFactory.createEmptyBorder(2,2,2,2)); break;
        }

        switch (newNation) {
            case Nation.GLOBAL: globalAnimation.stopFlashing();
                global.setBorder(BorderFactory.createLineBorder(Color.BLACK, 2));
                global.setForeground(Color.BLACK); break;
            case Nation.FRANCE: franceAnimation.stopFlashing();
                france.setBorder(BorderFactory.createLineBorder(Color.BLACK, 2));
                france.setForeground(Color.BLACK); break;
            case Nation.GREAT_BRITAIN: greatBritainAnimation.stopFlashing();
                greatBritain.setBorder(BorderFactory.createLineBorder(Color.BLACK, 2));
                greatBritain.setForeground(Color.BLACK); break;
            case Nation.PRUSSIA: prussiaAnimation.stopFlashing();
                prussia.setBorder(BorderFactory.createLineBorder(Color.BLACK, 2));
                prussia.setForeground(Color.BLACK); break;
            case Nation.RUSSIA: russiaAnimation.stopFlashing();
                russia.setBorder(BorderFactory.createLineBorder(Color.BLACK, 2));
                russia.setForeground(Color.BLACK); break;
            case Nation.OTTOMANS: ottomanAnimation.stopFlashing();
                ottoman.setBorder(BorderFactory.createLineBorder(Color.BLACK, 2));
                ottoman.setForeground(Color.BLACK); break;
            case Nation.AUSTRIA_HUNGRY: austriaAnimation.stopFlashing();
                austria.setBorder(BorderFactory.createLineBorder(Color.BLACK, 2));
                austria.setForeground(Color.BLACK); break;
            case Nation.SPAIN: spainAnimation.stopFlashing();
                spain.setBorder(BorderFactory.createLineBorder(Color.BLACK, 2));
                spain.setForeground(Color.BLACK); break;
            case Nation.TEAM: teamAnimation.stopFlashing();
                team.setBorder(BorderFactory.createLineBorder(Color.BLACK, 2));
                team.setForeground(Color.BLACK); break;
        }
    }

    public void messageReceived(int nation) {        
        if (nation != controller.getChatNation()) {
            switch (nation) {
                case Nation.GLOBAL: globalAnimation.start(); break;
                case Nation.FRANCE: franceAnimation.start(); break;
                case Nation.GREAT_BRITAIN: greatBritainAnimation.start(); break;
                case Nation.PRUSSIA: prussiaAnimation.start(); break;
                case Nation.RUSSIA: russiaAnimation.start(); break;
                case Nation.OTTOMANS: ottomanAnimation.start(); break;
                case Nation.AUSTRIA_HUNGRY: austriaAnimation.start(); break;
                case Nation.SPAIN: spainAnimation.start(); break;
                case Nation.TEAM: teamAnimation.start(); break;
            }
        }
    }


    public void actionPerformed(ActionEvent e) {
        String cmd = e.getActionCommand();

        if (cmd.equals(GameMsg.getString("declare.action"))) {
            Object[] options = {GameMsg.getString("declare.yes"), GameMsg.getString("declare.no")};
            int declareChoice = JOptionPane.showOptionDialog(display.getMap(), GameMsg.getString("declare.question") + " "
                    + GameMsg.getString("nation." + popupNation) + "?",
                    GameMsg.getString("declare.title"),
                    JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, options, options[1]);
            if (declareChoice == JOptionPane.YES_OPTION) {
                //todo declare war
            }
        } else if (cmd.equals(GameMsg.getString("armistice.action"))) {
            Object[] options = {GameMsg.getString("armistice.yes"), GameMsg.getString("armistice.no")};
            int armChoice = JOptionPane.showOptionDialog(display.getMap(), GameMsg.getString("armistice.question") + " "
                    + GameMsg.getString("nation." + popupNation) + "?",
                    GameMsg.getString("armistice.title"), JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE,
                    null, options, options[0]);
            if (armChoice == JOptionPane.YES_OPTION) {
                //todo request armistice
            }
        } else if (cmd.equals(GameMsg.getString("formAlly.action"))) {
            Object[] options = {GameMsg.getString("formAlly.yes"), GameMsg.getString("formAlly.no")};
            int formChoice = JOptionPane.showOptionDialog(display.getMap(), GameMsg.getString("formAlly.question") + " "
                    + GameMsg.getString("nation." + popupNation) + "?",
                    GameMsg.getString("formAlly.title"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE,
                    null, options, options[0]);
            if (formChoice == JOptionPane.YES_OPTION) {
                //todo request alliance
            }
        } else if (cmd.equals(GameMsg.getString("breakAlly.action"))) {
            Object[] options = {GameMsg.getString("breakAlly.yes"), GameMsg.getString("breakAlly.no")};
            int breakChoice = JOptionPane.showOptionDialog(display.getMap(), GameMsg.getString("breakAlly.question") + " "
                    + GameMsg.getString("nation." + popupNation) + "?",
                    GameMsg.getString("breakAlly.title"), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE,
                    null, options, options[1]);
            if (breakChoice == JOptionPane.YES_OPTION) {
                //todo break alliance
            }
        } else if (cmd.equals(GameMsg.getString("grantRights.action"))) {
            Object[] options = {GameMsg.getString("grant.yes"), GameMsg.getString("grant.no")};
            int grantChoice = JOptionPane.showOptionDialog(display.getMap(), GameMsg.getString("grant.question") + " "
                    + GameMsg.getString("nation." + popupNation) + "?",
                    GameMsg.getString("grant.title"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE,
                    null, options, options[0]);
            if (grantChoice == JOptionPane.YES_OPTION) {
                //todo grant rights
            }
        } else if (cmd.equals(GameMsg.getString("rescindRights.action"))) {
            Object[] options = {GameMsg.getString("rescind.yes"), GameMsg.getString("rescind.no")};
            int breakChoice = JOptionPane.showOptionDialog(display.getMap(), GameMsg.getString("rescind.question") + " "
                    + GameMsg.getString("nation." + popupNation) + "?",
                    GameMsg.getString("rescind.title"), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE,
                    null, options, options[1]);
            if (breakChoice == JOptionPane.YES_OPTION) {
                //todo rescind rights
            }
        } else if (cmd.equals(GameMsg.getString("nationSummary.action")))
            display.showNationSummary(popupNation);
        else if (cmd.equals(GameMsg.getString("commanderInfo.action")))
            display.showCommCard(popupNation);

    }

    public void mouseClicked(MouseEvent e) {
//        System.out.println("ChatNation: " + controller.getChatNation());
        if (e.getComponent().equals(global) )
            if (controller.getChatNation() != Nation.GLOBAL)
                controller.changeChatNation(Nation.GLOBAL);
        if (e.getComponent().equals(france) )
            if (e.getButton() == MouseEvent.BUTTON3 && controller.isPlayerNation(Nation.FRANCE)) {
                popupNation = Nation.FRANCE;
                nationPopup.show(e.getComponent(), e.getX(), e.getY());
            }
            else if (e.getButton() == MouseEvent.BUTTON1)
                if (controller.getChatNation() != Nation.FRANCE)
                    controller.changeChatNation(Nation.FRANCE);
        if (e.getComponent().equals(greatBritain) )
            if (e.getButton() == MouseEvent.BUTTON3 && controller.isPlayerNation(Nation.GREAT_BRITAIN)) {
                popupNation = Nation.GREAT_BRITAIN;
                nationPopup.show(e.getComponent(), e.getX(), e.getY());
            }
            else if (e.getButton() == MouseEvent.BUTTON1)
                if (controller.getChatNation() != Nation.GREAT_BRITAIN)
                    controller.changeChatNation(Nation.GREAT_BRITAIN);
        if (e.getComponent().equals(prussia) )
            if (e.getButton() == MouseEvent.BUTTON3 && controller.isPlayerNation(Nation.PRUSSIA)) {
                popupNation = Nation.PRUSSIA;
                nationPopup.show(e.getComponent(), e.getX(), e.getY());
            }
            else if (e.getButton() == MouseEvent.BUTTON1)
                if (controller.getChatNation() != Nation.PRUSSIA)
                    controller.changeChatNation(Nation.PRUSSIA);
        if (e.getComponent().equals(russia) )
            if (e.getButton() == MouseEvent.BUTTON3 && controller.isPlayerNation(Nation.RUSSIA)) {
                popupNation = Nation.RUSSIA;
                nationPopup.show(e.getComponent(), e.getX(), e.getY());
            }
            else if (e.getButton() == MouseEvent.BUTTON1)
                if (controller.getChatNation() != Nation.RUSSIA)
                    controller.changeChatNation(Nation.RUSSIA);
        if (e.getComponent().equals(ottoman) )
            if (e.getButton() == MouseEvent.BUTTON3 && controller.isPlayerNation(Nation.OTTOMANS)) {
                popupNation = Nation.OTTOMANS;
                nationPopup.show(e.getComponent(), e.getX(), e.getY());
            }
            else if (e.getButton() == MouseEvent.BUTTON1)
                if (controller.getChatNation() != Nation.OTTOMANS)
                    controller.changeChatNation(Nation.OTTOMANS);
        if (e.getComponent().equals(austria) )
            if (e.getButton() == MouseEvent.BUTTON3 && controller.isPlayerNation(Nation.AUSTRIA_HUNGRY)) {
                popupNation = Nation.AUSTRIA_HUNGRY;
                nationPopup.show(e.getComponent(), e.getX(), e.getY());
            }
            else if (e.getButton() == MouseEvent.BUTTON1)
                if (controller.getChatNation() != Nation.AUSTRIA_HUNGRY)
                    controller.changeChatNation(Nation.AUSTRIA_HUNGRY);
        if (e.getComponent().equals(spain) )
            if (e.getButton() == MouseEvent.BUTTON3 && controller.isPlayerNation(Nation.SPAIN)) {
                popupNation = Nation.SPAIN;
                nationPopup.show(e.getComponent(), e.getX(), e.getY());
            }
            else if (e.getButton() == MouseEvent.BUTTON1)
                if (controller.getChatNation() != Nation.SPAIN)
                    controller.changeChatNation(Nation.SPAIN);
        if (e.getComponent().equals(team) )
            if (controller.getChatNation() != Nation.TEAM)
                controller.changeChatNation(Nation.TEAM);
    }

    public void mousePressed(MouseEvent e) {
        //To change body of implemented methods use File | Settings | File Templates.
    }

    public void mouseReleased(MouseEvent e) {
        //To change body of implemented methods use File | Settings | File Templates.
    }

    public void mouseEntered(MouseEvent e) {
        //To change body of implemented methods use File | Settings | File Templates.
    }

    public void mouseExited(MouseEvent e) {
        //To change body of implemented methods use File | Settings | File Templates.
    }

    private GameController controller;
    private DisplayController display;

    private JLabel global;
    private JLabel france;
    private JLabel greatBritain;
    private JLabel prussia;
    private JLabel russia;
    private JLabel ottoman;
    private JLabel austria;
    private JLabel spain;

    private FlashAnimation globalAnimation;
    private FlashAnimation franceAnimation;
    private FlashAnimation greatBritainAnimation;
    private FlashAnimation prussiaAnimation;
    private FlashAnimation russiaAnimation;
    private FlashAnimation ottomanAnimation;
    private FlashAnimation austriaAnimation;
    private FlashAnimation spainAnimation;
    private FlashAnimation teamAnimation;

    private JPopupMenu nationPopup;
    private int popupNation;

    private int nation;

    private JLabel team;
}